package me.chan.stream;

import java.util.List;

import org.omg.Messaging.SyncScopeHelper;

import static java.util.stream.Collectors.toList;

import java.util.Arrays;

public class StreamDemo {

	public static void main(String[] args) {
		/*List<String> dishes = getDishList(Dish.menu);
		System.out.println(dishes);*/
		
		//List<Integer> numbers = Arrays.asList(1,2,1,3,3,3,2,4);
		//List<Integer> evenList = null;
		
		//distinct
		//numbers.stream().filter(i -> i %2 == 0)
		//						.distinct().forEach(System.out::println);
		//System.out.println(evenList);
		
		//skip
		Dish.menu.stream().filter(d -> d.getCalories() > 400).skip(2)
											.map(Dish::getName).forEach(System.out::println);
	}

	public static List<String> getDishList(List<Dish> menu) {
		return menu.stream().filter(d -> d.getCalories() >  400)
											.map(Dish::getName)
											.limit(3).collect(toList());
	}
}
